package com.liuguang.testassert;

import com.liuguang.testassert.congfig.MyConfigurationProperties;
import com.liuguang.testassert.filter.TestFilter2;
import com.liuguang.testassert.pojo.TestUser;
import com.liuguang.testassert.security.UserDetailServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.mybatis.spring.mapper.MapperScannerConfigurer;
import org.springframework.boot.Banner;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.security.SecurityProperties;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.context.annotation.Bean;
import org.springframework.security.authentication.dao.DaoAuthenticationProvider;
import org.springframework.security.web.FilterChainProxy;
import org.springframework.security.web.SecurityFilterChain;

import javax.servlet.Filter;
import java.util.List;
@Slf4j
@ServletComponentScan
@SpringBootApplication
public class TestassertApplication {

	public static void main(String[] args) {
		SpringApplication springApplication = new SpringApplication(TestassertApplication.class);
//		springApplication.setBannerMode(Banner.Mode.OFF);
		springApplication.run(args);
//		ConfigurableApplicationContext run = SpringApplication.run(TestassertApplication.class, args);

//		TestUser testUser = run.getBean("testUser", TestUser.class);
//		System.out.println(testUser);


//		FilterChainProxy filterChainProxy = (FilterChainProxy)run.getBean(FilterChainProxy.class);
//		List<SecurityFilterChain> filterChains = filterChainProxy.getFilterChains();
//		log.info("过滤器链集合：{}",filterChains);
//		log.info("过滤器链个数：{}",filterChains.size());
//		SecurityFilterChain securityFilterChain = filterChains.get(0);
//		List<Filter> filters = securityFilterChain.getFilters();
//		for (Filter filter : filters) {
//			System.out.println(filter.toString());
//		}
//		System.out.println("过滤器个数："+filters.size());




//		SecurityProperties
//		UserDetailServiceImpl userDetailServiceImpl = (UserDetailServiceImpl)run.getBean("userDetailServiceImpl");
//		userDetailServiceImpl.loadUserByUsername("王浩然");
	}

	//
//	@Bean
//	public TestFilter2 testFilter2() {
//		return new TestFilter2();
//	MapperScannerConfigurer
//	}
//	@Bean
//	public MyConfigurationProperties myConfigurationProperties() {
//		return new MyConfigurationProperties();
//	}
}
